export default{
  addGoods(context,payload){
    return new Promise((resolve,reject)=>{
      let duplicateGoods=context.state.goodsList.find(item=>{
        return item.id===payload.id
      })
      if(duplicateGoods){
        // duplicateGoods.count+=1
        context.commit('addCount',duplicateGoods)
      }
      else{
        // payload.count=1
        // state.goodsList.push(payload)
        context.commit('addGoods',payload)
      }

      resolve('添加商品成功')
    })

  },
  initUser(context,payload){
    return new Promise((resolve,reject)=>{
      context.commit('initUser',payload)
    })
  }
}
